<html>
<head><meta charset="utf-8"><title>tokio regression (#74614) · t-compiler/wg-polymorphization · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/index.html">t-compiler/wg-polymorphization</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html">tokio regression (#74614)</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="204640191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204640191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204640191">(Jul 22 2020 at 08:17)</a>:</h4>
<p>First bug with polymorphisation - <a href="https://github.com/rust-lang/rust/issues/74614">#74614</a></p>



<a name="204640286"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204640286" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204640286">(Jul 22 2020 at 08:18)</a>:</h4>
<p>As far as I can tell from looking at the backtrace is that we’re incorrectly considering a constant unused somewhere.</p>



<a name="204640851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204640851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204640851">(Jul 22 2020 at 08:26)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> oh, promoteds!</p>



<a name="204640855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204640855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204640855">(Jul 22 2020 at 08:26)</a>:</h4>
<p>I don't think you're visiting promoteds at all /facepalm</p>



<a name="204640907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204640907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204640907">(Jul 22 2020 at 08:27)</a>:</h4>
<p>although it's kind of weird that it doesn't just look like the use of the promoted uses all generic parameters, regardless of the contents</p>



<a name="204640996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204640996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204640996">(Jul 22 2020 at 08:28)</a>:</h4>
<p>like I would expect <code>fn foo&lt;X, Y&gt;() -&gt; &amp;'static i32 { &amp;0 }</code> to turn into <code>_0 = foo::&lt;X, Y&gt;::promoted0; return;</code></p>



<a name="204641006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641006">(Jul 22 2020 at 08:28)</a>:</h4>
<p>related? <a href="https://github.com/rust-lang/rust/issues/67176">https://github.com/rust-lang/rust/issues/67176</a></p>



<a name="204641035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641035">(Jul 22 2020 at 08:28)</a>:</h4>
<p>yeah I would expect us to be overly conservative, not the other way around</p>



<a name="204641051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641051">(Jul 22 2020 at 08:29)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> do we use <code>ty::Const</code> for an use of a promoted in the parent fn?</p>



<a name="204641066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641066">(Jul 22 2020 at 08:29)</a>:</h4>
<p>yes</p>



<a name="204641082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641082">(Jul 22 2020 at 08:29)</a>:</h4>
<p>I guess I can check</p>



<a name="204641099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641099">(Jul 22 2020 at 08:29)</a>:</h4>
<p>I should be able to even repro the bug</p>



<a name="204641154"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641154" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641154">(Jul 22 2020 at 08:30)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/transform/promote_consts.rs#L951">https://github.com/rust-lang/rust/blob/master/src/librustc_mir/transform/promote_consts.rs#L951</a></p>



<a name="204641206"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641206" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641206">(Jul 22 2020 at 08:31)</a>:</h4>
<p>I think your promtoed needs to depend on the generic parameter</p>



<a name="204641215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641215">(Jul 22 2020 at 08:31)</a>:</h4>
<p>otherwise it's gonna eval successfully polymorphically</p>



<a name="204641244"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641244" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641244">(Jul 22 2020 at 08:31)</a>:</h4>
<p>hmm I see</p>



<a name="204641377"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641377" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641377">(Jul 22 2020 at 08:33)</a>:</h4>
<p>though <a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=64b7aeea9d75674707591c9a8cc1ba75">https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=64b7aeea9d75674707591c9a8cc1ba75</a> works, ... so idk</p>



<a name="204641402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641402">(Jul 22 2020 at 08:34)</a>:</h4>
<p>playground is too old :(((</p>



<a name="204641442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641442">(Jul 22 2020 at 08:34)</a>:</h4>
<p>I hate when this happens</p>



<a name="204641446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641446">(Jul 22 2020 at 08:34)</a>:</h4>
<p>ah</p>



<a name="204641456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641456">(Jul 22 2020 at 08:34)</a>:</h4>
<p>well, in that case it may be my program causes the same failure</p>



<a name="204641467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641467">(Jul 22 2020 at 08:34)</a>:</h4>
<p>but I thought we had tests like this in our test suite</p>



<a name="204641475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641475">(Jul 22 2020 at 08:34)</a>:</h4>
<p>I have a smaller repro, arguably, if it does repro</p>



<a name="204641487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641487">(Jul 22 2020 at 08:34)</a>:</h4>
<p>I guess I can update nightly locally and try</p>



<a name="204641519"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641519" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641519">(Jul 22 2020 at 08:35)</a>:</h4>
<blockquote>
<p>info: skipping nightly which is missing installed component 'rustfmt-preview'</p>
</blockquote>



<a name="204641522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641522">(Jul 22 2020 at 08:35)</a>:</h4>
<p>ah that's why <em>sigh</em></p>



<a name="204641529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641529">(Jul 22 2020 at 08:35)</a>:</h4>
<p>how can we install nightlies with broken components</p>



<a name="204641538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641538">(Jul 22 2020 at 08:35)</a>:</h4>
<p>the last viable for me is 2020-07-11 rn</p>



<a name="204641554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641554">(Jul 22 2020 at 08:35)</a>:</h4>
<p>I just removed the component :P</p>



<a name="204641625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641625">(Jul 22 2020 at 08:36)</a>:</h4>
<p>although somehow playground has a nightly with a broken rustfmt huh. it's just an older one</p>



<a name="204641737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641737">(Jul 22 2020 at 08:37)</a>:</h4>
<p><code>rustc 1.47.0-nightly (8ad7bc3f4 2020-07-21)</code> should have it but I can't repro</p>



<a name="204641793"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641793" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641793">(Jul 22 2020 at 08:38)</a>:</h4>
<p>should it? we landed that pr on the 21st</p>



<a name="204641811"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641811" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641811">(Jul 22 2020 at 08:38)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/commits/8ad7bc3f428300aee6764f6e23527e19eb235e81">https://github.com/rust-lang/rust/commits/8ad7bc3f428300aee6764f6e23527e19eb235e81</a></p>



<a name="204641837"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641837" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641837">(Jul 22 2020 at 08:38)</a>:</h4>
<p>it's not the 21 nightly, it's the 22 nightly. but the last commit is from 21 (which is what the date indicates, it's the date of the commit hash)</p>



<a name="204641860"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641860" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641860">(Jul 22 2020 at 08:39)</a>:</h4>
<p>ah, til</p>



<a name="204641870"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641870" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641870">(Jul 22 2020 at 08:39)</a>:</h4>
<p>in my own testcase, <code>bar</code> has <code>_1 = const bar::&lt;X, Y&gt;::promoted[0];</code> so yeah I would expect polymorphization to see that</p>



<a name="204641890"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204641890" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204641890">(Jul 22 2020 at 08:39)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> yours doesn't repro either</p>



<a name="204642175"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204642175" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204642175">(Jul 22 2020 at 08:43)</a>:</h4>
<p>why does <code>#[rustc_polymorphize_error]</code> not trigger?</p>



<a name="204642252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204642252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204642252">(Jul 22 2020 at 08:44)</a>:</h4>
<p>shouldn't it tell me the result of the analysis?</p>



<a name="204642282"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204642282" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204642282">(Jul 22 2020 at 08:44)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/progress.20updates/near/204642175">said</a>:</p>
<blockquote>
<p>why does <code>#[rustc_polymorphize_error]</code> not trigger?</p>
</blockquote>
<p>doesn't that only emit errors for unused params</p>



<a name="204642296"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204642296" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204642296">(Jul 22 2020 at 08:44)</a>:</h4>
<p>so if all params are used this does nothing</p>



<a name="204642312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204642312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204642312">(Jul 22 2020 at 08:45)</a>:</h4>
<p>ah okay</p>



<a name="204642375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204642375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204642375">(Jul 22 2020 at 08:46)</a>:</h4>
<p>alright yeah I can see that in action</p>



<a name="204642657"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204642657" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204642657">(Jul 22 2020 at 08:48)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> <span class="user-mention" data-user-id="116107">@davidtwco</span> oh this might be a red herring, it could just be whatever's calling that <code>vtable</code> function</p>



<a name="204643048"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204643048" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204643048">(Jul 22 2020 at 08:52)</a>:</h4>
<p>maybe it's a cross-crate thing</p>



<a name="204643056"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204643056" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204643056">(Jul 22 2020 at 08:52)</a>:</h4>
<p>Will be at my computer to catch up in a moment</p>



<a name="204643090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204643090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204643090">(Jul 22 2020 at 08:52)</a>:</h4>
<p>so we get an ice in async task, but all tests seem to pass, interesting <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="204643100"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204643100" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204643100">(Jul 22 2020 at 08:53)</a>:</h4>
<p>presumably you can just compile tokio with <code>#[rustc_polymorphize_error]</code> on that function</p>



<a name="204643129"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204643129" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204643129">(Jul 22 2020 at 08:53)</a>:</h4>
<p>maybe our cross-crate encoding is subtly broken?</p>



<a name="204643276"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204643276" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204643276">(Jul 22 2020 at 08:55)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> oh dear that ICE is terrible</p>



<a name="204643300"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204643300" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204643300">(Jul 22 2020 at 08:55)</a>:</h4>
<p>it's using the span of the constant <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/monomorphize/collector.rs#L625-L630">https://github.com/rust-lang/rust/blob/master/src/librustc_mir/monomorphize/collector.rs#L625-L630</a></p>



<a name="204643303"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204643303" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204643303">(Jul 22 2020 at 08:55)</a>:</h4>
<p>so this is an use of <code>vtable</code> in another crate</p>



<a name="204643423"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204643423" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204643423">(Jul 22 2020 at 08:56)</a>:</h4>
<p>although it might still be the promoted. hmm. we just don't know</p>



<a name="204643628"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204643628" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204643628">(Jul 22 2020 at 08:59)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> so first thing I'd suggest doing is fixing this <a href="https://github.com/rust-lang/rust/issues/74614#issuecomment-662333759">https://github.com/rust-lang/rust/issues/74614#issuecomment-662333759</a></p>



<a name="204644214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204644214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204644214">(Jul 22 2020 at 09:07)</a>:</h4>
<p>alright, will do that</p>



<a name="204645662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204645662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204645662">(Jul 22 2020 at 09:26)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> sorry for the delay, turns out I broke my entire system last night and didn't realise, fixed now:</p>
<div class="codehilite"><pre><span></span><code>error: internal compiler error: src/librustc_mir/monomorphize/collector.rs:629:54: collection encountered polymorphic constant: Const { ty: &amp;tokio::runtime::task::raw::Vtable, val: Unevaluated(WithOptConstParam { did: DefId(34:3328 ~ tokio[1cd5]::runtime[0]::task[0]::raw[0]::vtable[0]), const_param_did: None }, [T, S], Some(promoted[0])) }
  --&gt; /home/david/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/raw.rs:31:5
   |
31 | /     &amp;Vtable {
32 | |         poll: poll::&lt;T, S&gt;,
33 | |         dealloc: dealloc::&lt;T, S&gt;,
34 | |         try_read_output: try_read_output::&lt;T, S&gt;,
35 | |         drop_join_handle_slow: drop_join_handle_slow::&lt;T, S&gt;,
36 | |         shutdown: shutdown::&lt;T, S&gt;,
37 | |     }
   | |_____^
</code></pre></div>



<a name="204645682"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204645682" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204645682">(Jul 22 2020 at 09:26)</a>:</h4>
<p>uhhhh how did you get that?</p>



<a name="204645699"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204645699" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204645699">(Jul 22 2020 at 09:27)</a>:</h4>
<p>that debug output</p>



<a name="204645706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204645706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204645706">(Jul 22 2020 at 09:27)</a>:</h4>
<p>that's the <code>self.body.source_info(location).span</code></p>



<a name="204645713"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204645713" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204645713">(Jul 22 2020 at 09:27)</a>:</h4>
<p>and <code>*constant</code> in the message</p>



<a name="204645723"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204645723" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204645723">(Jul 22 2020 at 09:27)</a>:</h4>
<p>remove the star :P</p>



<a name="204645764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204645764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204645764">(Jul 22 2020 at 09:27)</a>:</h4>
<p>or print both forms, but the "pretty" one is more immediately useful</p>



<a name="204645879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204645879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204645879">(Jul 22 2020 at 09:29)</a>:</h4>
<p>SO <code>[T, S]</code> is obviously wrong here <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="204645908"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204645908" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204645908">(Jul 22 2020 at 09:29)</a>:</h4>
<p>so anyway I suspect that if you put <code>#[rustc_polymorphize_error]</code> on the function it won't trigger</p>



<a name="204645912"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204645912" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204645912">(Jul 22 2020 at 09:29)</a>:</h4>
<p><a href="https://github.com/tokio-rs/tokio/blob/21f726041cf9a4ca408d97394af220caf90312ed/tokio/src/runtime/task/raw.rs#L30-L38">https://github.com/tokio-rs/tokio/blob/21f726041cf9a4ca408d97394af220caf90312ed/tokio/src/runtime/task/raw.rs#L30-L38</a></p>



<a name="204645918"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204645918" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204645918">(Jul 22 2020 at 09:29)</a>:</h4>
<p>mostly because I can't get it to reproduce</p>



<a name="204645970"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204645970" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204645970">(Jul 22 2020 at 09:30)</a>:</h4>
<p>it doesn't trigger, tried myself <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="204645990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204645990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204645990">(Jul 22 2020 at 09:30)</a>:</h4>
<div class="codehilite"><pre><span></span><code>error: internal compiler error: src/librustc_mir/monomorphize/collector.rs:629:54: collection encountered polymorphic constant: tokio::runtime::task::raw::vtable::&lt;T, S&gt;::promoted[0]
  --&gt; /home/david/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/raw.rs:31:5
   |
31 | /     &amp;Vtable {
32 | |         poll: poll::&lt;T, S&gt;,
33 | |         dealloc: dealloc::&lt;T, S&gt;,
34 | |         try_read_output: try_read_output::&lt;T, S&gt;,
35 | |         drop_join_handle_slow: drop_join_handle_slow::&lt;T, S&gt;,
36 | |         shutdown: shutdown::&lt;T, S&gt;,
37 | |     }
   | |_____^
</code></pre></div>



<a name="204646133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204646133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204646133">(Jul 22 2020 at 09:32)</a>:</h4>
<p>this is what I was using to look at the source btw <a href="https://github.com/tokio-rs/tokio/blob/tokio-0.2.22/tokio/src/runtime/task/raw.rs#L30-L38">https://github.com/tokio-rs/tokio/blob/tokio-0.2.22/tokio/src/runtime/task/raw.rs#L30-L38</a></p>



<a name="204646165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204646165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204646165">(Jul 22 2020 at 09:32)</a>:</h4>
<p>(specifically the version tag)</p>



<a name="204646574"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204646574" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204646574">(Jul 22 2020 at 09:39)</a>:</h4>
<p>I also don't get an error when annotating that function - <a href="http://sprunge.us/SYA96e">http://sprunge.us/SYA96e</a> has its promoted MIR</p>



<a name="204646597"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204646597" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204646597">(Jul 22 2020 at 09:40)</a>:</h4>
<p>yeah that makes sense. your analysis never sees this MIR AFAIK anwyay</p>



<a name="204646639"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204646639" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204646639">(Jul 22 2020 at 09:40)</a>:</h4>
<p>but the original MIR mentions <code>T</code> and <code>S</code></p>



<a name="204646650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204646650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204646650">(Jul 22 2020 at 09:40)</a>:</h4>
<p>so the problem is the cross-crate instantiation. maybe the <code>unused_generic_params</code> gets misinterpreted cross-crate?</p>



<a name="204647101"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647101" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647101">(Jul 22 2020 at 09:47)</a>:</h4>
<p>not sure if this is a repro for the same issue, but very related: <a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=27ddd7a5172f11db6e40f3e6a82ff50b">https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=27ddd7a5172f11db6e40f3e6a82ff50b</a></p>



<a name="204647120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647120">(Jul 22 2020 at 09:47)</a>:</h4>
<p>this has a linker error in today's nightly, but not on playground nightly</p>



<a name="204647201"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647201" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647201">(Jul 22 2020 at 09:48)</a>:</h4>
<p>you can <del>probably</del> (yea you can, tested) replace the <code>f</code> field's type with <code>PhantomData</code> and get the same result</p>



<a name="204647355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647355">(Jul 22 2020 at 09:50)</a>:</h4>
<p>I have a call in 10 minutes so I'll have to stop digging into this then for ~1hr.</p>



<a name="204647512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647512">(Jul 22 2020 at 09:53)</a>:</h4>
<p>further simplification:</p>
<div class="codehilite"><pre><span></span><code><span class="k">fn</span> <span class="nf">fop</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">bar</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="nb">&#39;static</span><span class="w"> </span><span class="k">fn</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="o">&amp;</span><span class="p">(</span><span class="n">fop</span>::<span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="k">fn</span><span class="p">())</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">bar</span>::<span class="o">&lt;</span><span class="kt">u32</span><span class="o">&gt;</span><span class="p">();</span><span class="w"></span>
<span class="w">    </span><span class="n">bar</span>::<span class="o">&lt;</span><span class="kt">i32</span><span class="o">&gt;</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="204647527"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647527" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647527">(Jul 22 2020 at 09:53)</a>:</h4>
<p>.... that's my repro lmao</p>



<a name="204647547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647547">(Jul 22 2020 at 09:53)</a>:</h4>
<p>why did I not think to try more than one instantiation /facepalm</p>



<a name="204647637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647637">(Jul 22 2020 at 09:54)</a>:</h4>
<p>(well, I know why, I was too focused on the bug here, not some other linker thing from multiple instantiations)</p>



<a name="204647657"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647657" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647657">(Jul 22 2020 at 09:54)</a>:</h4>
<p>the multi-instantiation doesn't change anything?</p>



<a name="204647676"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647676" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647676">(Jul 22 2020 at 09:55)</a>:</h4>
<p>if you remove one of the <code>bar</code> instances you get something I tried</p>



<a name="204647680"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647680" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647680">(Jul 22 2020 at 09:55)</a>:</h4>
<p>I thought it would, but I'm getting undefined reference, not duplicate symbol</p>



<a name="204647705"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647705" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647705">(Jul 22 2020 at 09:55)</a>:</h4>
<p>which, for me, didn't do anything weird</p>



<a name="204647711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647711">(Jul 22 2020 at 09:55)</a>:</h4>
<p>nope</p>



<a name="204647716"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647716" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647716">(Jul 22 2020 at 09:55)</a>:</h4>
<div class="codehilite"><pre><span></span><code>  = note: /usr/bin/ld: /home/oliver/foo/target/debug/deps/foo-131d2e4b307e33df.1ocxrrfk7nbb4m82.rcgu.o:(.data.rel.ro..L__unnamed_2+0x0): undefined reference to `foo::fop&#39;
          /usr/bin/ld: /home/oliver/foo/target/debug/deps/foo-131d2e4b307e33df: hidden symbol `_ZN3foo3fop17hade81fe2ae460f25E&#39; isn&#39;t defined
</code></pre></div>



<a name="204647737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647737">(Jul 22 2020 at 09:55)</a>:</h4>
<p>with one <code>bar</code> instantiation?</p>



<a name="204647738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647738">(Jul 22 2020 at 09:55)</a>:</h4>
<p>same thing as I got, just one less undefined reference</p>



<a name="204647740"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647740" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647740">(Jul 22 2020 at 09:55)</a>:</h4>
<p>yes</p>



<a name="204647788"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647788" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647788">(Jul 22 2020 at 09:56)</a>:</h4>
<p>but that's.... just... something I tried. what</p>



<a name="204647794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647794">(Jul 22 2020 at 09:56)</a>:</h4>
<p>with both:</p>
<div class="codehilite"><pre><span></span><code>  = note: /usr/bin/ld: /home/oliver/foo/target/debug/deps/foo-131d2e4b307e33df.1ocxrrfk7nbb4m82.rcgu.o:(.data.rel.ro..L__unnamed_3+0x0): undefined reference to `foo::fop&#39;
          /usr/bin/ld: /home/oliver/foo/target/debug/deps/foo-131d2e4b307e33df.1ocxrrfk7nbb4m82.rcgu.o:(.data.rel.ro..L__unnamed_4+0x0): undefined reference to `foo::fop&#39;
          /usr/bin/ld: /home/oliver/foo/target/debug/deps/foo-131d2e4b307e33df: hidden symbol `_ZN3foo3fop17hade81fe2ae460f25E&#39; isn&#39;t defined
</code></pre></div>



<a name="204647807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647807">(Jul 22 2020 at 09:56)</a>:</h4>
<p>I get the same as <span class="user-mention silent" data-user-id="124288">oli</span></p>



<a name="204647808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647808">(Jul 22 2020 at 09:56)</a>:</h4>
<div class="codehilite"><pre><span></span><code>~/foo (master|…) [101] $ rustc --version
rustc 1.47.0-nightly (8ad7bc3f4 2020-07-21)
</code></pre></div>



<a name="204647812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647812">(Jul 22 2020 at 09:56)</a>:</h4>
<p>oh ugh you're using cargo</p>



<a name="204647821"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647821" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647821">(Jul 22 2020 at 09:56)</a>:</h4>
<p>hahaha</p>



<a name="204647829"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647829" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647829">(Jul 22 2020 at 09:56)</a>:</h4>
<p>with a local build and invoking rustc directly</p>



<a name="204647845"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647845" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647845">(Jul 22 2020 at 09:57)</a>:</h4>
<p>let me try to find where exactly the difference is, this is frustrating</p>



<a name="204647860"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647860" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647860">(Jul 22 2020 at 09:57)</a>:</h4>
<p>invoking rustc directly:</p>
<div class="codehilite"><pre><span></span><code>  = note: /usr/bin/ld: main.main.7rcbfp3g-cgu.0.rcgu.o:(.data.rel.ro..L__unnamed_3+0x0): undefined reference to `main::fop&#39;
          /usr/bin/ld: main.main.7rcbfp3g-cgu.0.rcgu.o:(.data.rel.ro..L__unnamed_4+0x0): undefined reference to `main::fop&#39;
          /usr/bin/ld: main: hidden symbol `_ZN4main3fop17hd551d777c2e8d68aE&#39; isn&#39;t defined
</code></pre></div>



<a name="204647876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647876">(Jul 22 2020 at 09:57)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> fun thing to try: add <code>-Z symbol-mangling-version=v0</code></p>



<a name="204647878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647878">(Jul 22 2020 at 09:57)</a>:</h4>
<p>(same with one invocation</p>



<a name="204647884"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647884" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647884">(Jul 22 2020 at 09:57)</a>:</h4>
<p>anyway, I need to run briefly - I don't understand enough about how we do constants/promoteds to be very useful at the moment anyway.</p>



<a name="204647900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647900">(Jul 22 2020 at 09:57)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> I doubt that's the problem, since the parameters are treated as used correctly</p>



<a name="204647948"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647948" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647948">(Jul 22 2020 at 09:58)</a>:</h4>
<p>because they show up in the use of the promoted in the parent function</p>



<a name="204647949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647949">(Jul 22 2020 at 09:58)</a>:</h4>
<p>that flag just makes the output worse</p>



<a name="204647952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647952">(Jul 22 2020 at 09:58)</a>:</h4>
<div class="codehilite"><pre><span></span><code>  = note: /usr/bin/ld: main.main.7rcbfp3g-cgu.0.rcgu.o:(.data.rel.ro..L__unnamed_2+0x0): undefined reference to `_RINvCs4fqI2P2rA04_4main3fopmEB2_&#39;
          /usr/bin/ld: main: hidden symbol `_RINvCs4fqI2P2rA04_4main3fopmEB2_&#39; isn&#39;t defined
</code></pre></div>



<a name="204647953"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647953" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647953">(Jul 22 2020 at 09:58)</a>:</h4>
<p>so we're just being conservative</p>



<a name="204647974"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647974" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647974">(Jul 22 2020 at 09:58)</a>:</h4>
<p>what are you calling "worse"? :P</p>



<a name="204647994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204647994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204647994">(Jul 22 2020 at 09:58)</a>:</h4>
<p>not demangled by the linker <span aria-label="stuck out tongue" class="emoji emoji-1f61d" role="img" title="stuck out tongue">:stuck_out_tongue:</span></p>



<a name="204648012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204648012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204648012">(Jul 22 2020 at 09:58)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> oh actually this helps lmao</p>



<a name="204648030"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204648030" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204648030">(Jul 22 2020 at 09:59)</a>:</h4>
<p>see the <code>E</code> at the end? that ends a list of generic parameters. run that through <code>rustfilt</code></p>



<a name="204648039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204648039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204648039">(Jul 22 2020 at 09:59)</a>:</h4>
<p>(<code>cargo install rustfilt</code> if you haven't already)</p>



<a name="204648059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204648059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204648059">(Jul 22 2020 at 09:59)</a>:</h4>
<p>I bet you <code>m</code> is the mangling of <code>u32</code></p>



<a name="204648072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204648072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204648072">(Jul 22 2020 at 10:00)</a>:</h4>
<p><code>main::fop::&lt;u32&gt;</code></p>



<a name="204648153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204648153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204648153">(Jul 22 2020 at 10:00)</a>:</h4>
<div class="codehilite"><pre><span></span><code>~/foo (master|…) $ rustfilt _RINvCs4fqI2P2rA04_4main3foplEB2_
main::fop::&lt;i32&gt;
~/foo (master|…) $ rustfilt _RINvCs4fqI2P2rA04_4main3fopmEB2_
main::fop::&lt;u32&gt;
</code></pre></div>



<a name="204648156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204648156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204648156">(Jul 22 2020 at 10:00)</a>:</h4>
<p>neat</p>



<a name="204648185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204648185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204648185">(Jul 22 2020 at 10:00)</a>:</h4>
<p>yeah so something is using the non-generic <code>Instance</code></p>



<a name="204648189"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204648189" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204648189">(Jul 22 2020 at 10:01)</a>:</h4>
<p>so we currently don't polymorphize in const eval?</p>



<a name="204648203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204648203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204648203">(Jul 22 2020 at 10:01)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> wow I can't believe I didn't try one of the things I had tried on playground</p>



<a name="204648214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204648214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204648214">(Jul 22 2020 at 10:01)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span> it's not that, I think perhaps we don't polymorphize the <em>output</em> of const eval</p>



<a name="204648226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204648226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204648226">(Jul 22 2020 at 10:01)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> I had added a use of <code>T</code> to my <code>foo</code> in the hopes of triggering something</p>



<a name="204648285"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204648285" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204648285">(Jul 22 2020 at 10:02)</a>:</h4>
<p>/me shakes fist at playground not instantly updating to latest nightly</p>



<a name="204648484"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204648484" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204648484">(Jul 22 2020 at 10:05)</a>:</h4>
<p>presumably here? <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_codegen_llvm/common.rs#L259">https://github.com/rust-lang/rust/blob/master/src/librustc_codegen_llvm/common.rs#L259</a></p>



<a name="204648555"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204648555" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204648555">(Jul 22 2020 at 10:06)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> you can try adding a <code>.polymorphize()</code> on the RHS of that arm</p>



<a name="204648570"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204648570" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204648570">(Jul 22 2020 at 10:06)</a>:</h4>
<p>am trying it out</p>



<a name="204648580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204648580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204648580">(Jul 22 2020 at 10:06)</a>:</h4>
<p>thanks <span class="user-mention" data-user-id="216206">@lcnr</span> !</p>



<a name="204648590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204648590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204648590">(Jul 22 2020 at 10:06)</a>:</h4>
<p>I doubt this will actually fix the problem in <code>tokio</code> though, which occurs in the collector</p>



<a name="204648611"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204648611" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204648611">(Jul 22 2020 at 10:07)</a>:</h4>
<p>we don't know what instantiates <code>fn vtable</code>, the bug might be entirely there</p>



<a name="204648749"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204648749" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204648749">(Jul 22 2020 at 10:09)</a>:</h4>
<p>works with this change</p>



<a name="204648806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204648806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204648806">(Jul 22 2020 at 10:10)</a>:</h4>
<p>there are some other uses of <code>GlobalAlloc::Function</code> which somewhat worry me</p>



<a name="204648862"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204648862" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204648862">(Jul 22 2020 at 10:10)</a>:</h4>
<p>will try to build reqwest with this change for now</p>



<a name="204648867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204648867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204648867">(Jul 22 2020 at 10:10)</a>:</h4>
<p>only relevant outside miri</p>



<a name="204648891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204648891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204648891">(Jul 22 2020 at 10:10)</a>:</h4>
<p>The collector has an invocation, too, maybe you can trigger it by making the repro example a library instead of a binary</p>



<a name="204648906"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204648906" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204648906">(Jul 22 2020 at 10:11)</a>:</h4>
<p>(and making the <code>bar</code> function public)</p>



<a name="204649002"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204649002" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204649002">(Jul 22 2020 at 10:12)</a>:</h4>
<div class="codehilite"><pre><span></span><code><span class="n">GlobalAlloc</span>::<span class="n">Function</span><span class="p">(</span><span class="n">fn_instance</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="k">if</span><span class="w"> </span><span class="n">should_codegen_locally</span><span class="p">(</span><span class="n">tcx</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="n">fn_instance</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                </span><span class="n">trace</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;collecting {:?} with {:#?}&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">alloc_id</span><span class="p">,</span><span class="w"> </span><span class="n">fn_instance</span><span class="p">);</span><span class="w"></span>
<span class="w">                </span><span class="n">output</span><span class="p">.</span><span class="n">push</span><span class="p">(</span><span class="n">create_fn_mono_item</span><span class="p">(</span><span class="n">tcx</span><span class="p">,</span><span class="w"> </span><span class="n">fn_instance</span><span class="p">,</span><span class="w"> </span><span class="n">DUMMY_SP</span><span class="p">));</span><span class="w"></span>
<span class="w">            </span><span class="p">}</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="204649018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204649018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204649018">(Jul 22 2020 at 10:12)</a>:</h4>
<p>does <code>create_fn_mono_item</code> not call <code>polymorphize</code>?</p>



<a name="204649019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204649019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204649019">(Jul 22 2020 at 10:12)</a>:</h4>
<p>afk for a few minutes</p>



<a name="204649109"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204649109" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204649109">(Jul 22 2020 at 10:14)</a>:</h4>
<p>hmm... no</p>
<div class="codehilite"><pre><span></span><code><span class="k">fn</span> <span class="nf">fop</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>

<span class="sd">/// ```rust</span>
<span class="sd">/// (foo::FN)()</span>
<span class="sd">/// ```</span>
<span class="k">pub</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">FN</span>: <span class="kp">&amp;</span><span class="nb">&#39;static</span><span class="w"> </span><span class="k">fn</span><span class="p">()</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="p">(</span><span class="n">fop</span>::<span class="o">&lt;</span><span class="kt">i32</span><span class="o">&gt;</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="k">fn</span><span class="p">());</span><span class="w"></span>
<span class="k">pub</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">FN2</span>: <span class="kp">&amp;</span><span class="nb">&#39;static</span><span class="w"> </span><span class="k">fn</span><span class="p">()</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="p">(</span><span class="n">fop</span>::<span class="o">&lt;</span><span class="kt">u32</span><span class="o">&gt;</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="k">fn</span><span class="p">());</span><span class="w"></span>
</code></pre></div>


<p>just has the same linker error</p>



<a name="204649117"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204649117" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204649117">(Jul 22 2020 at 10:14)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/progress.20updates/near/204649018">said</a>:</p>
<blockquote>
<p>does <code>create_fn_mono_item</code> not call <code>polymorphize</code>?</p>
</blockquote>
<p>yea, I didn't think about that</p>



<a name="204650422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204650422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204650422">(Jul 22 2020 at 10:32)</a>:</h4>
<p>just renamed the topic, I was getting really  tired of "progress updates". hopefully nobody minds ^_^</p>



<a name="204650959"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204650959" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204650959">(Jul 22 2020 at 10:41)</a>:</h4>
<p>reqwest ice is still there though</p>



<a name="204651567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204651567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204651567">(Jul 22 2020 at 10:49)</a>:</h4>
<p>opened <a href="https://github.com/rust-lang/rust/issues/74623">#74623</a> with the current state</p>



<a name="204652976"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204652976" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204652976">(Jul 22 2020 at 11:13)</a>:</h4>
<div class="codehilite"><pre><span></span><code>error: internal compiler error: src/librustc_mir/monomorphize/collector.rs:629:54: collection encountered polymorphic constant:
Const {
ty: &amp;tokio::runtime::task::raw::Vtable,
val: Unevaluated(WithOptConstParam {
    did: DefId(34:3328 ~ tokio[1cd5]::runtime[0]::task[0]::raw[0]::vtable[0]), const_param_did: None },
    [T, S],
    Some(promoted[0])) },
substituted_constant:
Const {
ty: &amp;tokio::runtime::task::raw::Vtable,
val: Unevaluated(WithOptConstParam {
    did: DefId(34:3328 ~ tokio[1cd5]::runtime[0]::task[0]::raw[0]::vtable[0]), const_param_did: None },
    [
        futures_util::future::Map&lt;futures_util::future::PollFn&lt;[closure@hyper::Client::&lt;C, B&gt;::send_request::{{closure}}#0::{{closure}}#2::{{closure}}#0 0:hyper::client::pool::Pooled&lt;hyper::client::PoolClient&lt;async_impl::body::ImplStream&gt;&gt;]&gt;
, [closure@hyper::Client::&lt;C, B&gt;::send_request::{{closure}}#0::{{closure}}#2::{{closure}}#1 0:futures_channel::oneshot::Sender&lt;hyper::common::never::Never&gt;]&gt;, std::sync::Arc&lt;tokio::runtime::basic_scheduler::Shared&gt;
], Some(promoted[0]))
}
</code></pre></div>



<a name="204653028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204653028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204653028">(Jul 22 2020 at 11:13)</a>:</h4>
<p><span aria-label="laughter tears" class="emoji emoji-1f602" role="img" title="laughter tears">:laughter_tears:</span> nice, I always knew we needed std::<span aria-label="cow" class="emoji emoji-1f404" role="img" title="cow">:cow:</span>::Cow</p>



<a name="204653033"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204653033" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204653033">(Jul 22 2020 at 11:14)</a>:</h4>
<p>The playground can’t update for a reason that will probably shock you:</p>
<div class="codehilite"><pre><span></span><code>error: internal compiler error: src/librustc_mir/monomorphize/collector.rs:629:54: collection encountered polymorphic constant
  --&gt; /playground/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.21/src/runtime/task/raw.rs:30:1
   |
30 | / pub(super) fn vtable&lt;T: Future, S: Schedule&gt;() -&gt; &amp;&#39;static Vtable {
31 | |     &amp;Vtable {
32 | |         poll: poll::&lt;T, S&gt;,
33 | |         dealloc: dealloc::&lt;T, S&gt;,
...  |
37 | |     }
38 | | }
   | |_^
thread &#39;rustc&#39; panicked at &#39;Box&lt;Any&gt;&#39;, /rustc/8ad7bc3f428300aee6764f6e23527e19eb235e81/src/libstd/macros.rs:13:23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&amp;template=ice.md
note: rustc 1.47.0-nightly (8ad7bc3f4 2020-07-21) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 --crate-type lib
note: some of the compiler flags provided by cargo are hidden
</code></pre></div>



<a name="204653248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204653248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204653248">(Jul 22 2020 at 11:17)</a>:</h4>
<p><span aria-label="sad" class="emoji emoji-2639" role="img" title="sad">:sad:</span></p>



<a name="204653302"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204653302" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204653302">(Jul 22 2020 at 11:18)</a>:</h4>
<p>so from what I see Client is still polymorphic here <code>closure@hyper::Client::&lt;C, B&gt;::send_request::{{closure}}#0::{{closure}}#2::{{closure}}#0</code></p>



<a name="204653512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204653512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204653512">(Jul 22 2020 at 11:21)</a>:</h4>
<p>the method <a href="https://gist.github.com/lcnr/918396773ed18651fb2a0624b08068f6">https://gist.github.com/lcnr/918396773ed18651fb2a0624b08068f6</a></p>



<a name="204653727"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204653727" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204653727">(Jul 22 2020 at 11:24)</a>:</h4>
<p>back now (will have to pop away shortly if I want to eat today but can respond to messages again)</p>



<a name="204653884"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204653884" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204653884">(Jul 22 2020 at 11:27)</a>:</h4>
<p>Care for yourself first and foremost. Tired/hungry brains aren't useful ;-)</p>



<a name="204654715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204654715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204654715">(Jul 22 2020 at 11:38)</a>:</h4>
<p>all def ids used in <code>substituted_constant</code>: <a href="https://gist.github.com/lcnr/c81ce3953ecf1d05f867e0c18e1ccc86">https://gist.github.com/lcnr/c81ce3953ecf1d05f867e0c18e1ccc86</a></p>
<p>there are a lot of them</p>



<a name="204655407"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204655407" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204655407">(Jul 22 2020 at 11:51)</a>:</h4>
<p><span class="user-mention" data-user-id="116155">@Jake Goulding</span> just incredible</p>



<a name="204655530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204655530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204655530">(Jul 22 2020 at 11:53)</a>:</h4>
<p>I guess it's non-trivial to ignore one of those failures, because Cargo expects you'll need all dependencies</p>



<a name="204656230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204656230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204656230">(Jul 22 2020 at 12:00)</a>:</h4>
<p>We have</p>
<div class="codehilite"><pre><span></span><code><span class="p">[</span><span class="n">INFO</span><span class="w">  </span><span class="n">rustc_mir</span>::<span class="n">interpret</span>::<span class="n">step</span><span class="p">]</span><span class="w"> </span><span class="n">_2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">tokio</span>::<span class="n">runtime</span>::<span class="n">task</span>::<span class="n">raw</span>::<span class="n">poll</span>::<span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">S</span><span class="o">&gt;</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="k">unsafe</span><span class="w"> </span><span class="k">fn</span><span class="p">(</span><span class="n">std</span>::<span class="n">ptr</span>::<span class="n">NonNull</span><span class="o">&lt;</span><span class="n">tokio</span>::<span class="n">runtime</span>::<span class="n">task</span>::<span class="n">core</span>::<span class="n">Header</span><span class="o">&gt;</span><span class="p">)</span><span class="w"> </span><span class="p">(</span><span class="n">Pointer</span><span class="p">(</span><span class="n">ReifyFnPointer</span><span class="p">))</span><span class="w"></span>
<span class="p">[</span><span class="n">TRACE</span><span class="w"> </span><span class="n">rustc_mir</span>::<span class="n">interpret</span>::<span class="n">eval_context</span><span class="p">]</span><span class="w"> </span><span class="n">_2</span>: <span class="nc">is</span><span class="w"> </span><span class="n">uninitialized</span><span class="w"></span>
</code></pre></div>



<a name="204656587"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204656587" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204656587">(Jul 22 2020 at 12:05)</a>:</h4>
<p>that's fine, isn't it? the problem much earlier, when <code>fn vtable</code> is instantiated <em>from somewhere</em></p>



<a name="204656617"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204656617" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204656617">(Jul 22 2020 at 12:05)</a>:</h4>
<p>miri can probably handle generic function pointers until they're used</p>



<a name="204657624"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204657624" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204657624">(Jul 22 2020 at 12:16)</a>:</h4>
<p>Why is <code>U</code> used here?</p>
<div class="codehilite"><pre><span></span><code><span class="cp">#![feature(rustc_attrs)]</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">test</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>

<span class="k">pub</span><span class="w"> </span><span class="k">struct</span> <span class="nc">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">v</span>: <span class="nc">unsafe</span><span class="w"> </span><span class="k">fn</span><span class="p">(),</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="cp">#[rustc_polymorphize_error]</span><span class="w"></span>
<span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">U</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="nb">&#39;static</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="o">&amp;</span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">v</span>: <span class="nc">test</span>::<span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">foo</span>::<span class="o">&lt;</span><span class="kt">u8</span><span class="p">,</span><span class="w"> </span><span class="p">()</span><span class="o">&gt;</span><span class="p">();</span><span class="w"></span>
<span class="w">    </span><span class="n">foo</span>::<span class="o">&lt;</span><span class="kt">u16</span><span class="p">,</span><span class="w"> </span><span class="p">()</span><span class="o">&gt;</span><span class="p">();</span><span class="w"></span>
<span class="w">    </span><span class="k">unsafe</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="p">(</span><span class="n">foo</span>::<span class="o">&lt;</span><span class="kt">u32</span><span class="p">,</span><span class="w"> </span><span class="p">()</span><span class="o">&gt;</span><span class="p">().</span><span class="n">v</span><span class="p">)();</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="204657852"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204657852" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204657852">(Jul 22 2020 at 12:19)</a>:</h4>
<p>THAT'S NOT FINE</p>



<a name="204657859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204657859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204657859">(Jul 22 2020 at 12:19)</a>:</h4>
<p>I CAN WALK ON WATER</p>



<a name="204657866"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204657866" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204657866">(Jul 22 2020 at 12:19)</a>:</h4>
<div class="codehilite"><pre><span></span><code><span class="cp">#![feature(rustc_attrs)]</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">test</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>

<span class="k">pub</span><span class="w"> </span><span class="k">struct</span> <span class="nc">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">v</span>: <span class="nc">unsafe</span><span class="w"> </span><span class="k">fn</span><span class="p">(),</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="cp">#[rustc_polymorphize_error]</span><span class="w"></span>
<span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span>: <span class="nc">T</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="nb">&#39;static</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="o">&amp;</span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">v</span>: <span class="nc">test</span>::<span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">outer</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="nb">&#39;static</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">foo</span><span class="p">(</span><span class="o">||</span><span class="w"> </span><span class="p">())</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>


<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">outer</span>::<span class="o">&lt;</span><span class="kt">u8</span><span class="o">&gt;</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="204657948"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204657948" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204657948">(Jul 22 2020 at 12:20)</a>:</h4>
<p>nice!</p>



<a name="204657975"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204657975" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204657975">(Jul 22 2020 at 12:20)</a>:</h4>
<div class="codehilite"><pre><span></span><code><span class="k">fn</span> <span class="nf">test</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">std</span>::<span class="n">mem</span>::<span class="n">size_of</span>::<span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">();</span><span class="w"> </span><span class="p">}</span><span class="w"></span>

<span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span>: <span class="nc">T</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="nb">&#39;static</span><span class="w"> </span><span class="k">fn</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="o">&amp;</span><span class="p">(</span><span class="n">test</span>::<span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="k">fn</span><span class="p">())</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">outer</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">foo</span><span class="p">(</span><span class="o">||</span><span class="w"> </span><span class="p">());</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>


<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">outer</span>::<span class="o">&lt;</span><span class="kt">u8</span><span class="o">&gt;</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>


<p>minimized</p>



<a name="204658072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204658072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204658072">(Jul 22 2020 at 12:21)</a>:</h4>
<p>The problem is here <a href="https://github.com/rust-lang/rust/blob/4825e12fc9c79954aa0fe18f5521efa6c19c7539/src/librustc_mir/interpret/cast.rs#L49-L52">https://github.com/rust-lang/rust/blob/4825e12fc9c79954aa0fe18f5521efa6c19c7539/src/librustc_mir/interpret/cast.rs#L49-L52</a></p>



<a name="204658537"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204658537" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204658537">(Jul 22 2020 at 12:27)</a>:</h4>
<p>test doesn't have be polymorphized, only <code>|| ()</code></p>



<a name="204658637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204658637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204658637">(Jul 22 2020 at 12:28)</a>:</h4>
<p>which results in <code>test::&lt;closure@src/main.rs:10:9: 10:14&gt;</code>, with a polymorphized closure</p>



<a name="204658660"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204658660" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204658660">(Jul 22 2020 at 12:28)</a>:</h4>
<p>which contains a type parameter, causing the <code>ReifyFnPointer</code> cast to fail</p>



<a name="204658855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204658855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204658855">(Jul 22 2020 at 12:31)</a>:</h4>
<p>closures are the worst</p>



<a name="204658873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204658873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204658873">(Jul 22 2020 at 12:31)</a>:</h4>
<p>eddy helped me fix so many ICEs with polymorphisation and closures</p>



<a name="204659092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204659092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204659092">(Jul 22 2020 at 12:33)</a>:</h4>
<p>Why doesn't ice then? Doesn't <code>unused</code> also get polymorphized here?</p>
<div class="codehilite"><pre><span></span><code><span class="k">fn</span> <span class="nf">unused</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">test</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">println</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;type name: {}&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">std</span>::<span class="n">any</span>::<span class="n">type_name</span>::<span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">());</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span>: <span class="nc">T</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="nb">&#39;static</span><span class="w"> </span><span class="k">fn</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="o">&amp;</span><span class="p">(</span><span class="n">test</span>::<span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="k">fn</span><span class="p">())</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">outer</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">foo</span><span class="p">(</span><span class="n">unused</span>::<span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">)();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">outer</span>::<span class="o">&lt;</span><span class="kt">u8</span><span class="o">&gt;</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="204659201"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204659201" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204659201">(Jul 22 2020 at 12:34)</a>:</h4>
<p>foo isn't called?</p>



<a name="204659210"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204659210" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204659210">(Jul 22 2020 at 12:34)</a>:</h4>
<p>so it won't get visited during monomorphisation collection?</p>



<a name="204659226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204659226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204659226">(Jul 22 2020 at 12:34)</a>:</h4>
<p>unless this is a library, in which case it would because it's public</p>



<a name="204659237"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204659237" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204659237">(Jul 22 2020 at 12:35)</a>:</h4>
<p>I am now calling foo</p>



<a name="204659261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204659261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204659261">(Jul 22 2020 at 12:35)</a>:</h4>
<p><span aria-label="face palm" class="emoji emoji-1f926" role="img" title="face palm">:face_palm:</span></p>



<a name="204659438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204659438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204659438">(Jul 22 2020 at 12:37)</a>:</h4>
<p>seems like any use of <code>T</code> in <code>outer</code> will stop the ICE</p>



<a name="204659491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204659491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204659491">(Jul 22 2020 at 12:37)</a>:</h4>
<p>and <code>unused::&lt;T&gt;</code> qualifies, but adding a <code>std::mem::size_of::&lt;T&gt;()</code> statement before also works</p>



<a name="204659586"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204659586" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204659586">(Jul 22 2020 at 12:38)</a>:</h4>
<div class="codehilite"><pre><span></span><code><span class="k">fn</span> <span class="nf">test</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>

<span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span>: <span class="nc">T</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="nb">&#39;static</span><span class="w"> </span><span class="k">fn</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="o">&amp;</span><span class="p">(</span><span class="n">test</span>::<span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="k">fn</span><span class="p">())</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">outer</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">std</span>::<span class="n">mem</span>::<span class="n">size_of</span>::<span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">();</span><span class="w"></span>
<span class="w">    </span><span class="n">foo</span><span class="p">(</span><span class="o">||</span><span class="w"> </span><span class="p">());</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">outer</span>::<span class="o">&lt;</span><span class="kt">u8</span><span class="o">&gt;</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>


<p>causes a linker error - does your PR fix that?</p>



<a name="204660565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204660565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204660565">(Jul 22 2020 at 12:49)</a>:</h4>
<p>I've convinced myself that your hypothesis that <code>outer</code>'s polymorphized type parameter being inherited by it's closure, which ends up as <code>T</code> in <code>foo</code>, which participates in the <code>ReifyFnPointer</code> cast causes the ICE is definitely correct. </p>
<p>My assumption would be that the fix needs to be in the const eval because polymorphisation cannot consider outer's parameter used without being transitive - which isn't possible.</p>



<a name="204660579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204660579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204660579">(Jul 22 2020 at 12:49)</a>:</h4>
<p>your example does not ice</p>



<a name="204660645"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204660645" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204660645">(Jul 22 2020 at 12:50)</a>:</h4>
<p>yeah, I didn't expect it to ICE with this issue, but it had a linker error for me.</p>



<a name="204660657"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204660657" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204660657">(Jul 22 2020 at 12:50)</a>:</h4>
<p>that one is fixed</p>



<a name="204660668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204660668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204660668">(Jul 22 2020 at 12:50)</a>:</h4>
<p>wasn't sure if it was the same issue is all</p>



<a name="204660734"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204660734" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204660734">(Jul 22 2020 at 12:51)</a>:</h4>
<blockquote>
<p>My assumption would be that the fix needs to be in the const eval because polymorphisation cannot consider outer's parameter used without being transitive - which isn't possible.</p>
</blockquote>
<p>hmm, can we just disable this check though <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="204660748"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204660748" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204660748">(Jul 22 2020 at 12:51)</a>:</h4>
<p>I think we it should be fine, but not completely sure</p>



<a name="204660815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204660815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204660815">(Jul 22 2020 at 12:52)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> <span class="user-mention" data-user-id="119009">@eddyb</span> would know, I assume</p>



<a name="204660871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204660871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204660871">(Jul 22 2020 at 12:53)</a>:</h4>
<p>the same exists for <code>Pointer(PointerCast::ClosureFnPointer(_))</code></p>



<a name="204660925"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204660925" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204660925">(Jul 22 2020 at 12:53)</a>:</h4>
<p>maybe it needs something like the "still further specializable" flag which ignores parent substs in closures?</p>



<a name="204660986"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204660986" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204660986">(Jul 22 2020 at 12:54)</a>:</h4>
<p>uhhhh I'd be surprised if miri had to change</p>



<a name="204660995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204660995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204660995">(Jul 22 2020 at 12:54)</a>:</h4>
<p>the same exists for <code>type_name</code> and <code>type_id</code></p>



<a name="204661002"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204661002" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204661002">(Jul 22 2020 at 12:54)</a>:</h4>
<p>but also this seems more intricate than I had given it credit?</p>



<a name="204661032"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204661032" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204661032">(Jul 22 2020 at 12:54)</a>:</h4>
<p>imo using <code>ty::Param</code> here seems error prone</p>



<a name="204661038"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204661038" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204661038">(Jul 22 2020 at 12:54)</a>:</h4>
<p>in interpret</p>



<a name="204661053"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204661053" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204661053">(Jul 22 2020 at 12:54)</a>:</h4>
<p>wait a second.... are we talking about changing miri or about changing the collector to remove that assert?</p>



<a name="204661068"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204661068" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204661068">(Jul 22 2020 at 12:55)</a>:</h4>
<p>because I can totally see that assert simply being wrong now</p>



<a name="204661077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204661077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204661077">(Jul 22 2020 at 12:55)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> wait wasn't there a thing about miri function pointers being to generic instances?</p>



<a name="204661086"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204661086" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204661086">(Jul 22 2020 at 12:55)</a>:</h4>
<p>no idea</p>



<a name="204661114"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204661114" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204661114">(Jul 22 2020 at 12:55)</a>:</h4>
<p>cause you can't substitute allocations</p>



<a name="204661134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204661134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204661134">(Jul 22 2020 at 12:56)</a>:</h4>
<p>my brain hurts</p>



<a name="204661211"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204661211" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204661211">(Jul 22 2020 at 12:56)</a>:</h4>
<p>aah, ok, so I see why we may want to modify miri</p>



<a name="204661262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204661262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204661262">(Jul 22 2020 at 12:57)</a>:</h4>
<p>we want to be allowed to create function pointers that are still polymorphic</p>



<a name="204661312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204661312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204661312">(Jul 22 2020 at 12:57)</a>:</h4>
<p>do we though? we don't track the parameters</p>



<a name="204661332"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204661332" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204661332">(Jul 22 2020 at 12:57)</a>:</h4>
<p>like there's no way to tell that an allocation is "generic" over some parameters</p>



<a name="204661348"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204661348" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204661348">(Jul 22 2020 at 12:58)</a>:</h4>
<p>without deeply looking into it</p>



<a name="204661404"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204661404" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204661404">(Jul 22 2020 at 12:58)</a>:</h4>
<p>from the outside it looks concrete</p>



<a name="204661412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204661412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204661412">(Jul 22 2020 at 12:58)</a>:</h4>
<p>I think they'd only be polymorphic in that the closure inherits an unused generic parameter from a parent.</p>



<a name="204661460"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204661460" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204661460">(Jul 22 2020 at 12:58)</a>:</h4>
<p>do we want to prevent miri from failing to evaluate in that case?</p>



<a name="204661476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204661476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204661476">(Jul 22 2020 at 12:58)</a>:</h4>
<p>should miri use <code>Instance::polymorphize</code>?</p>



<a name="204661849"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204661849" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204661849">(Jul 22 2020 at 13:02)</a>:</h4>
<div class="codehilite"><pre><span></span><code><span class="gh">diff --git a/src/librustc_mir/interpret/cast.rs b/src/librustc_mir/interpret/cast.rs</span>
<span class="gh">index 60cf21552e9..ee9d1d156ab 100644</span>
<span class="gd">--- a/src/librustc_mir/interpret/cast.rs</span>
<span class="gi">+++ b/src/librustc_mir/interpret/cast.rs</span>
<span class="gu">@@ -47,7 +47,7 @@ impl&lt;&#39;mir, &#39;tcx: &#39;mir, M: Machine&lt;&#39;mir, &#39;tcx&gt;&gt; InterpCx&lt;&#39;mir, &#39;tcx, M&gt; {</span>
                 match src.layout.ty.kind {
                     ty::FnDef(def_id, substs) =&gt; {
                         // All reifications must be monomorphic, bail out otherwise.
<span class="gd">-                        if src.layout.ty.needs_subst() {</span>
<span class="gi">+                        if src.layout.ty.still_further_specializable() {</span>
                             throw_inval!(TooGeneric);
                         }
</code></pre></div>


<p>This obviously wouldn't be <em>the</em> fix, but it stops the ICE.</p>



<a name="204661882"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204661882" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204661882">(Jul 22 2020 at 13:02)</a>:</h4>
<p>(at least in <span class="user-mention silent" data-user-id="216206">lcnr</span>'s repro, not checked reqwest)</p>



<a name="204661939"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204661939" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204661939">(Jul 22 2020 at 13:02)</a>:</h4>
<p>ooooh I'm starting to see what's happening</p>



<a name="204661960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204661960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204661960">(Jul 22 2020 at 13:03)</a>:</h4>
<p>miri isn't allowing too much, it's allowing too little</p>



<a name="204662012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662012">(Jul 22 2020 at 13:03)</a>:</h4>
<p>btw, this should also fail on <code>type_id</code> and I don't know how we can fix it there</p>



<a name="204662016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662016">(Jul 22 2020 at 13:03)</a>:</h4>
<p>so it gives back <code>TooGeneric</code> in a situation that could've theoretically worked (it still doesn't feel right that it could be polymorphized but maybe it could)</p>



<a name="204662115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662115">(Jul 22 2020 at 13:04)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span> I mean the fact that <code>type_id</code> <em>could</em> be called means the parameters should be treated as used</p>



<a name="204662136"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662136" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662136">(Jul 22 2020 at 13:04)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span> I don't think it's a problem for <code>type_id</code> or <code>type_name</code> unless polymorphization figures out all calls return the same value</p>



<a name="204662137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662137">(Jul 22 2020 at 13:04)</a>:</h4>
<p>so this sounds like there's a different bug</p>



<a name="204662181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662181">(Jul 22 2020 at 13:05)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/tokio.20regression.20(.2374614)/near/204662115">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> I mean the fact that <code>type_id</code> <em>could</em> be called means the parameters should be treated as used</p>
</blockquote>
<p>this requires global analysis. x for doubt</p>



<a name="204662185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662185">(Jul 22 2020 at 13:05)</a>:</h4>
<p>we recently had a nightly const eval bug on <code>type_id</code> or <code>type_name</code>, but I thought it was fixed on nightly already</p>



<a name="204662191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662191">(Jul 22 2020 at 13:05)</a>:</h4>
<p>let me get an example</p>



<a name="204662216"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662216" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662216">(Jul 22 2020 at 13:05)</a>:</h4>
<p>how? polymorphization conservatively assumes parameters are used</p>



<a name="204662221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662221">(Jul 22 2020 at 13:05)</a>:</h4>
<p>This is a different instance of the same issue we saw in implementing polymorphisation where how a closure is used in a later function could influence if an inherited parameter should be considered used in the current function.</p>



<a name="204662241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662241">(Jul 22 2020 at 13:05)</a>:</h4>
<p>how could the constant call <code>type_id::&lt;T&gt;()</code> without polymorphization assuming <code>T</code> is used</p>



<a name="204662335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662335">(Jul 22 2020 at 13:06)</a>:</h4>
<p>could <code>T</code> be a closure containing an unused inherited type parameter?</p>



<a name="204662406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662406">(Jul 22 2020 at 13:07)</a>:</h4>
<p>oh it requires closures. okay. I got confused about that</p>



<a name="204662451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662451">(Jul 22 2020 at 13:07)</a>:</h4>
<p>has anyone found the closure in <code>tokio</code>/<code>reqwest</code> or did <span class="user-mention" data-user-id="216206">@lcnr</span> experiment until closures showed up?</p>



<a name="204662489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662489">(Jul 22 2020 at 13:07)</a>:</h4>
<p>I don't know if <span class="user-mention" data-user-id="216206">@lcnr</span> found it, by the time I got back there was a small repro.</p>



<a name="204662521"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662521" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662521">(Jul 22 2020 at 13:08)</a>:</h4>
<p>These:</p>
<blockquote>
<p>all def ids used in <code>substituted_constant</code>: <a href="https://gist.github.com/lcnr/c81ce3953ecf1d05f867e0c18e1ccc86">https://gist.github.com/lcnr/c81ce3953ecf1d05f867e0c18e1ccc86</a></p>
</blockquote>



<a name="204662552"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662552" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662552">(Jul 22 2020 at 13:08)</a>:</h4>
<p><code>move |cx| pooled.poll_ready(cx)</code></p>



<a name="204662578"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662578" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662578">(Jul 22 2020 at 13:08)</a>:</h4>
<p>okay huh</p>



<a name="204662628"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662628" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662628">(Jul 22 2020 at 13:09)</a>:</h4>
<p>so in short, the problem is passing a polymorphized closure type to some generic and not knowing whether reflection will be used on it</p>



<a name="204662689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662689">(Jul 22 2020 at 13:09)</a>:</h4>
<p>so either reflection or polymorphization must admit defeat, and this is where "it needs a global analysis" comes in</p>



<a name="204662691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662691">(Jul 22 2020 at 13:09)</a>:</h4>
<p>The problem is that codegened closures now can contain ty::Param</p>



<a name="204662752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662752">(Jul 22 2020 at 13:10)</a>:</h4>
<p>which fails the checks added in <a href="https://github.com/rust-lang/rust/pull/74538">https://github.com/rust-lang/rust/pull/74538</a></p>



<a name="204662761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662761">(Jul 22 2020 at 13:10)</a>:</h4>
<p>the missing thing for me was that we're talking about the <code>ty::Closure</code>, not the closure <code>Instance</code></p>



<a name="204662782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662782">(Jul 22 2020 at 13:10)</a>:</h4>
<p>closure and generator substs, mabe even <code>FnDef</code> subst</p>



<a name="204662785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662785">(Jul 22 2020 at 13:10)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/tokio.20regression.20(.2374614)/near/204662628">said</a>:</p>
<blockquote>
<p>so in short, the problem is passing a polymorphized closure type to some generic and not knowing whether reflection will be used on it</p>
</blockquote>
<p>or something which can end up in a <code>ReifyFnPointer</code> cast, I think?</p>



<a name="204662789"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662789" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662789">(Jul 22 2020 at 13:10)</a>:</h4>
<p>like it's specifically the closure <em>type</em> that's broken</p>



<a name="204662824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662824">(Jul 22 2020 at 13:10)</a>:</h4>
<p>(unless we consider that reflection)</p>



<a name="204662826"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662826" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662826">(Jul 22 2020 at 13:10)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> okay but that's solvable I think? oh wait it's solvable in all cases lol</p>



<a name="204662858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662858">(Jul 22 2020 at 13:11)</a>:</h4>
<p>just call <code>polymorphize</code> on it and somehow erase those parameters from reflection</p>



<a name="204662876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662876">(Jul 22 2020 at 13:11)</a>:</h4>
<p>might be harder than it sounds but unless it cycle-errors it should work</p>



<a name="204662905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662905">(Jul 22 2020 at 13:11)</a>:</h4>
<p>this does mean that polymorphization is observable as a canonicalization that overlaps types (reflection-wise)</p>



<a name="204662916"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204662916" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204662916">(Jul 22 2020 at 13:11)</a>:</h4>
<p>which may be scary</p>



<a name="204663038"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204663038" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204663038">(Jul 22 2020 at 13:12)</a>:</h4>
<p>I've not been able to construct a case that uses reflection and ICEs - do we have one?</p>



<a name="204663062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204663062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204663062">(Jul 22 2020 at 13:13)</a>:</h4>
<p>what do you mean with reflection here?</p>



<a name="204663071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204663071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204663071">(Jul 22 2020 at 13:13)</a>:</h4>
<p><code>type_id</code> / <code>type_name</code></p>



<a name="204663097"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204663097" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204663097">(Jul 22 2020 at 13:13)</a>:</h4>
<p>for them to actually cause problems we first have to land <a href="https://github.com/rust-lang/rust/issues/74538">#74538</a></p>



<a name="204663117"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204663117" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204663117">(Jul 22 2020 at 13:13)</a>:</h4>
<p>Being pragmatic, when do y'all start thinking of a revert? I know it's "only nightly" and all, but.</p>



<a name="204663121"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204663121" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204663121">(Jul 22 2020 at 13:13)</a>:</h4>
<p>like I'm thinking the user can observe polymorphization</p>



<a name="204663134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204663134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204663134">(Jul 22 2020 at 13:13)</a>:</h4>
<p><span class="user-mention" data-user-id="116155">@Jake Goulding</span> we can literally just turn it off tbh</p>



<a name="204663211"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204663211" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204663211">(Jul 22 2020 at 13:14)</a>:</h4>
<p>oh btw I should've mentioned: if you want to make nightly work again on <a href="http://play.rust-lang.org">play.rust-lang.org</a> you can do <code>RUSTFLAGS=-Zpolymorphize=off</code> for now I think?</p>



<a name="204663225"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204663225" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204663225">(Jul 22 2020 at 13:14)</a>:</h4>
<p>After <a href="https://github.com/rust-lang/rust/issues/74538">#74538</a> I would expect this to ice:</p>
<div class="codehilite"><pre><span></span><code><span class="k">use</span><span class="w"> </span><span class="n">std</span>::<span class="n">any</span>::<span class="n">TypeId</span><span class="p">;</span><span class="w"></span>

<span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">T</span>: <span class="nb">&#39;static</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span>: <span class="nc">T</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">TypeId</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">TypeId</span>::<span class="n">of</span>::<span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">()</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">outer</span><span class="o">&lt;</span><span class="n">T</span>: <span class="nb">&#39;static</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">foo</span><span class="p">(</span><span class="o">||</span><span class="w"> </span><span class="p">());</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">outer</span>::<span class="o">&lt;</span><span class="kt">u8</span><span class="o">&gt;</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="204663240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204663240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204663240">(Jul 22 2020 at 13:15)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> wait did we never crater polymorphization?</p>



<a name="204663256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204663256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204663256">(Jul 22 2020 at 13:15)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/tokio.20regression.20(.2374614)/near/204663240">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="116107">davidtwco</span> wait did we never crater polymorphization?</p>
</blockquote>
<p>nope</p>



<a name="204663274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204663274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204663274">(Jul 22 2020 at 13:15)</a>:</h4>
<p>did I forget to suggest that? or did I never think about it</p>



<a name="204663278"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204663278" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204663278">(Jul 22 2020 at 13:15)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/tokio.20regression.20(.2374614)/near/204663225">said</a>:</p>
<blockquote>
<p>After <a href="https://github.com/rust-lang/rust/issues/74538">#74538</a> I would expect this to ice:</p>
<div class="codehilite"><pre><span></span><code><span class="k">use</span><span class="w"> </span><span class="n">std</span>::<span class="n">any</span>::<span class="n">TypeId</span><span class="p">;</span><span class="w"></span>

<span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">T</span>: <span class="nb">&#39;static</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span>: <span class="nc">T</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">TypeId</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">TypeId</span>::<span class="n">of</span>::<span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">()</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">outer</span><span class="o">&lt;</span><span class="n">T</span>: <span class="nb">&#39;static</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">foo</span><span class="p">(</span><span class="o">||</span><span class="w"> </span><span class="p">());</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">outer</span>::<span class="o">&lt;</span><span class="kt">u8</span><span class="o">&gt;</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>


</blockquote>
<p>That's pretty much what I had locally, didn't know there wasn't a bail out already.</p>



<a name="204663283"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204663283" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204663283">(Jul 22 2020 at 13:15)</a>:</h4>
<p>given the bugs we found it would've made sense :|</p>



<a name="204663307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204663307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204663307">(Jul 22 2020 at 13:15)</a>:</h4>
<p>I'm not worried about the playground at all. It's deliberately designed to weather this kind of issue.</p>



<a name="204663389"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204663389" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204663389">(Jul 22 2020 at 13:16)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> btw I'm more worried about what happens when it works, without ICE-ing</p>



<a name="204663406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204663406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204663406">(Jul 22 2020 at 13:16)</a>:</h4>
<p>sure <span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="204663411"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204663411" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204663411">(Jul 22 2020 at 13:16)</a>:</h4>
<p><code>type_name</code> might be able to show the difference better</p>



<a name="204663423"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204663423" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204663423">(Jul 22 2020 at 13:16)</a>:</h4>
<p>we kind of have to decide what to do here I think</p>



<a name="204663446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204663446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204663446">(Jul 22 2020 at 13:17)</a>:</h4>
<p>so I believe this only effects closures, generators and functions rn</p>



<a name="204663464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204663464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204663464">(Jul 22 2020 at 13:17)</a>:</h4>
<p>so I am personally fine with printing dummy parameters here</p>



<a name="204663507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204663507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204663507">(Jul 22 2020 at 13:17)</a>:</h4>
<p>we also don't guarantee that <code>a_fn != b_fn</code> for two different functions (or at least if we do, that guarantee is already broken rn)</p>



<a name="204663548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204663548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204663548">(Jul 22 2020 at 13:18)</a>:</h4>
<p>so I think it's ok if they have the same <code>TypeId</code> (that's on fairly thin ice though)</p>



<a name="204663872"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204663872" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204663872">(Jul 22 2020 at 13:21)</a>:</h4>
<p>I don't think it can affect functions because we don't hide a subset of <code>ty::FnDef</code>'s substs from "generic param is used" logic</p>



<a name="204663897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204663897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204663897">(Jul 22 2020 at 13:22)</a>:</h4>
<p>just <code>ty::Closure</code>/<code>ty::Generator</code></p>



<a name="204664002"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204664002" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204664002">(Jul 22 2020 at 13:22)</a>:</h4>
<div class="codehilite"><pre><span></span><code><span class="k">fn</span> <span class="nf">unused</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">outer</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="nb">drop</span><span class="p">(</span><span class="n">unused</span>::<span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">outer</span>::<span class="o">&lt;</span><span class="kt">u8</span><span class="o">&gt;</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="204664019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204664019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204664019">(Jul 22 2020 at 13:23)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/tokio.20regression.20(.2374614)/near/204663872">said</a>:</p>
<blockquote>
<p>I don't think it can affect functions because we don't hide a subset of <code>ty::FnDef</code>'s substs from "generic param is used" logic</p>
</blockquote>
<p>can we polymorphize <code>unused</code> here?</p>



<a name="204664094"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204664094" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204664094">(Jul 22 2020 at 13:23)</a>:</h4>
<p>well we never codegen <code>unused</code></p>



<a name="204664147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204664147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204664147">(Jul 22 2020 at 13:24)</a>:</h4>
<p>but I think <code>outer</code> will be fully monomorphized</p>



<a name="204664165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204664165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204664165">(Jul 22 2020 at 13:24)</a>:</h4>
<p>so it will call <code>drop::&lt;typeof unused::&lt;u8&gt;&gt;</code></p>



<a name="204664207"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204664207" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204664207">(Jul 22 2020 at 13:24)</a>:</h4>
<p>keep in mind the the type can be less generic than the destination of a call on a value of that type</p>



<a name="204664233"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204664233" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204664233">(Jul 22 2020 at 13:24)</a>:</h4>
<p>which sounds like I'm losing my mind but is technically true</p>



<a name="204664299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204664299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204664299">(Jul 22 2020 at 13:25)</a>:</h4>
<p>like if you try to call <code>unused::&lt;u8&gt;()</code> it will call the polymorphized version, despite the value <code>unused::&lt;u8&gt;</code> not being polymorphic</p>



<a name="204664416"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204664416" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204664416">(Jul 22 2020 at 13:26)</a>:</h4>
<p>So if instead of <code>drop</code> we have an actual function which uses its input</p>



<a name="204664464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204664464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204664464">(Jul 22 2020 at 13:26)</a>:</h4>
<p>that function would be monomorphized, even if <code>unused</code> is polymorphized</p>



<a name="204664490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204664490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204664490">(Jul 22 2020 at 13:27)</a>:</h4>
<p>closure polymorphization tries to avoid this</p>



<a name="204664735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204664735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204664735">(Jul 22 2020 at 13:29)</a>:</h4>
<blockquote>
<p>that function would be monomorphized, even if unused is polymorphized</p>
</blockquote>
<p>which means we codegen that inner function exactly once for all different instances of <code>unused</code>?</p>



<a name="204664891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204664891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204664891">(Jul 22 2020 at 13:30)</a>:</h4>
<p>so we have to "partially polymorphize" the inner function over <code>unused&lt;T&gt;</code> instead of over <code>T</code></p>



<a name="204664972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204664972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204664972">(Jul 22 2020 at 13:31)</a>:</h4>
<p>Am I correct that there are two issues here? </p>
<ul>
<li>Casts (<a href="https://github.com/rust-lang/rust/blob/e22b61bff0bdd08be7665607cb7be3748c8a35d2/src/librustc_mir/interpret/cast.rs#L49-L52">here</a> and <a href="https://github.com/rust-lang/rust/blob/e22b61bff0bdd08be7665607cb7be3748c8a35d2/src/librustc_mir/interpret/cast.rs#L91-L94">here</a>) which would fix reqwest and fix the regression we've got right now - <a href="https://github.com/rust-lang/rust/issues/74614">#74614</a>.</li>
<li>Reflection (<code>type_name</code> and <code>type_id</code>) is more complicated because it's potentially observable but won't ICE until <a href="https://github.com/rust-lang/rust/issues/74538">#74538</a>.</li>
</ul>



<a name="204665108"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204665108" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204665108">(Jul 22 2020 at 13:32)</a>:</h4>
<p>Both hit by having a closure with inherited unused type parameter but it just depends what you do with it.</p>



<a name="204665279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204665279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204665279">(Jul 22 2020 at 13:33)</a>:</h4>
<p>and pretty sure this also hits <code>get_vtable</code></p>



<a name="204665354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204665354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204665354">(Jul 22 2020 at 13:34)</a>:</h4>
<p>let me quickly check</p>



<a name="204665990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204665990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204665990">(Jul 22 2020 at 13:38)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/tokio.20regression.20(.2374614)/near/204664735">said</a>:</p>
<blockquote>
<blockquote>
<p>that function would be monomorphized, even if unused is polymorphized</p>
</blockquote>
<p>which means we codegen that inner function exactly once for all different instances of <code>unused</code>?</p>
</blockquote>
<p>the other way around</p>



<a name="204666058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204666058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204666058">(Jul 22 2020 at 13:39)</a>:</h4>
<p><code>unused</code> is codegen'd once, but the function calling it might think it's calling <code>unused::&lt;u8&gt;</code>, <code>unused::&lt;u32&gt;</code> etc. as different functions</p>



<a name="204666229"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204666229" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204666229">(Jul 22 2020 at 13:40)</a>:</h4>
<div class="codehilite"><pre><span></span><code><span class="k">use</span><span class="w"> </span><span class="n">std</span>::<span class="n">marker</span>::<span class="n">PhantomData</span><span class="p">;</span><span class="w"></span>

<span class="k">struct</span> <span class="nc">A</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">PhantomData</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">);</span><span class="w"></span>

<span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">T</span>: <span class="nb">&#39;static</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="nb">Send</span><span class="o">&gt;</span><span class="p">(</span><span class="n">v</span>: <span class="nc">T</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="nb">&#39;static</span><span class="w"> </span><span class="o">&amp;</span><span class="nb">&#39;static</span><span class="w"> </span><span class="k">dyn</span><span class="w"> </span><span class="nb">Send</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="o">&amp;</span><span class="p">(</span><span class="o">&amp;</span><span class="n">A</span>::<span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">PhantomData</span><span class="p">)</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">_</span><span class="p">)</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">outer</span><span class="o">&lt;</span><span class="n">T</span>: <span class="nb">&#39;static</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="nb">Send</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">foo</span><span class="p">(</span><span class="o">||</span><span class="w"> </span><span class="p">());</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">outer</span>::<span class="o">&lt;</span><span class="kt">u8</span><span class="o">&gt;</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="204666252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204666252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204666252">(Jul 22 2020 at 13:40)</a>:</h4>
<p>I remember us having issues with vtables</p>



<a name="204666259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204666259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204666259">(Jul 22 2020 at 13:40)</a>:</h4>
<p>so this totally tracks</p>



<a name="204666414"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204666414" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204666414">(Jul 22 2020 at 13:42)</a>:</h4>
<p>I wish I could help out more but I'm trying to not get too distracted by this (from more pressing stuff) and also my brain is melting in the balkan dayheat</p>



<a name="204666563"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204666563" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204666563">(Jul 22 2020 at 13:43)</a>:</h4>
<p>all of the heat with none of the ocean clouds or w/e coastal western europe gets</p>



<a name="204666738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204666738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204666738">(Jul 22 2020 at 13:44)</a>:</h4>
<p>I can put a PR up which fixes <a href="https://github.com/rust-lang/rust/issues/74614">#74614</a> by using <code>still_further_specializable</code> (which is what we want semantically but wasn't intended for this) and then we can figure out a better fix with the time that gives us; alternatively, I can put a PR up which disables polymorphisation.</p>



<a name="204666843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204666843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204666843">(Jul 22 2020 at 13:45)</a>:</h4>
<p>I don't think <code>still_further_specializable</code> is the right choice here, we will get the same breakage without a clean solution in <a href="https://github.com/rust-lang/rust/issues/74538">#74538</a></p>



<a name="204666897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204666897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204666897">(Jul 22 2020 at 13:45)</a>:</h4>
<p>i.e. we can't use <code>still_further_specializable</code> there</p>



<a name="204667212"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204667212" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204667212">(Jul 22 2020 at 13:47)</a>:</h4>
<p>couldn't we use <code>still_further_specializable</code> to avoid the ICE in that case but we'd still need to decide if polymorphisation should be observable through <code>still_further_specializable</code>, right?</p>



<a name="204667269"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204667269" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204667269">(Jul 22 2020 at 13:48)</a>:</h4>
<p>even if it just fixed the cast case using <code>still_further_specializable</code>, the reflection case is much less common, I expect</p>



<a name="204667346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204667346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204667346">(Jul 22 2020 at 13:48)</a>:</h4>
<p>We need to check for <code>needs_subst</code> there to fix <a href="https://github.com/rust-lang/rust/issues/73976">#73976</a></p>



<a name="204667371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204667371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204667371">(Jul 22 2020 at 13:48)</a>:</h4>
<p>which has soundness concerns afaict</p>



<a name="204667659"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204667659" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204667659">(Jul 22 2020 at 13:50)</a>:</h4>
<p>regardless of what we end up doing for the reflection case, I don't understand that as well, I think we should fix the cast case for today's regression using <code>still_further_specializable</code> for now</p>



<a name="204667756"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204667756" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204667756">(Jul 22 2020 at 13:51)</a>:</h4>
<p>should we consider disabling polymorphization by default until we get a crater run in?</p>



<a name="204667760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204667760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204667760">(Jul 22 2020 at 13:51)</a>:</h4>
<p>I think we have to add something like <code>TyKind::Polymorphized</code> here if we are not able to somehow get the <code>ty::Param</code> out of closure substs</p>



<a name="204667796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204667796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204667796">(Jul 22 2020 at 13:51)</a>:</h4>
<p>until then I would like to disable polymorphization :/</p>



<a name="204667840"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204667840" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204667840">(Jul 22 2020 at 13:51)</a>:</h4>
<p>alright, I'll put a PR up which disables polymorphization</p>



<a name="204668303"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204668303" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204668303">(Jul 22 2020 at 13:54)</a>:</h4>
<p>(to be clear that's solely based on my impression that we're not quite thinking this is "last touch up" so to speak)</p>



<a name="204671065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204671065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204671065">(Jul 22 2020 at 14:15)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/74633">#74633</a></p>



<a name="204674210"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204674210" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204674210">(Jul 22 2020 at 14:37)</a>:</h4>
<p>Filed <a href="https://github.com/rust-lang/rust/issues/74636">#74636</a> for fixing the underlying regression</p>



<a name="204678813"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204678813" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204678813">(Jul 22 2020 at 15:10)</a>:</h4>
<p>Putting aside the question about if/how polymorphisation should be observable with reflection, if we changed the relevant <code>needs_subst</code> checks in const_eval to something with <code>still_further_specializable</code>'s semantics - would everything else <em>just work</em>?</p>



<a name="204679025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204679025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204679025">(Jul 22 2020 at 15:12)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span>  CI is green on <a href="https://github.com/rust-lang/rust/issues/74633">#74633</a>, any reason I shouldn't r+ it?</p>



<a name="204679080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204679080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204679080">(Jul 22 2020 at 15:12)</a>:</h4>
<p>If that's the direction we want to go, no, r+ away.</p>



<a name="204679117"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204679117" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204679117">(Jul 22 2020 at 15:13)</a>:</h4>
<p>Vs trying to land a fix?</p>



<a name="204679131"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204679131" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204679131">(Jul 22 2020 at 15:13)</a>:</h4>
<p>Yeah</p>



<a name="204679141"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204679141" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204679141">(Jul 22 2020 at 15:13)</a>:</h4>
<p>gotcha</p>



<a name="204679167"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204679167" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204679167">(Jul 22 2020 at 15:13)</a>:</h4>
<p>It's possible there are other regressions we've not found though, given there's not been a crater run.</p>



<a name="204679182"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204679182" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204679182">(Jul 22 2020 at 15:13)</a>:</h4>
<p>I think it makes sense to land this now since we know it breaks stuff</p>



<a name="204679186"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204679186" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204679186">(Jul 22 2020 at 15:13)</a>:</h4>
<p>Yeah</p>



<a name="204679388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204679388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204679388">(Jul 22 2020 at 15:14)</a>:</h4>
<p>It's easy enough to flip the default back and do a crater run in another PR.</p>



<a name="204685466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204685466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204685466">(Jul 22 2020 at 15:58)</a>:</h4>
<blockquote>
<p>would everything else just work?</p>
</blockquote>
<p>we have to differentiate between polymorphized closures and not fully concrete closures if we don't want <code>TypeId::of&lt;Self&gt; != TypeId::of&lt;Self&gt;</code></p>



<a name="204685530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204685530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204685530">(Jul 22 2020 at 15:58)</a>:</h4>
<p>And I don't think using <code>still_further_specializable</code> is enough for this</p>



<a name="204687744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204687744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204687744">(Jul 22 2020 at 16:15)</a>:</h4>
<blockquote>
<p>And I don't think using <code>still_further_specializable</code> is enough for this</p>
</blockquote>
<p>That’s what I’d like to understand - why not? </p>
<p>I suppose we’d be better off invoking polymorphisation to check that parameters which are present are unused, rather than assuming that any params present in parent substs are a result of polymorphisation.</p>



<a name="204721004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204721004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204721004">(Jul 22 2020 at 20:48)</a>:</h4>
<p>(just noting that chalk also hit a polymorphization issue which is very likely the same as tokio)</p>



<a name="204721123"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204721123" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204721123">(Jul 22 2020 at 20:49)</a>:</h4>
<p>I can make sure it actually is the same if we need to be sure ?</p>



<a name="204721915"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204721915" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204721915">(Jul 22 2020 at 20:56)</a>:</h4>
<p>doesn't hurt if you have the time <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span></p>



<a name="204722757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204722757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204722757">(Jul 22 2020 at 21:03)</a>:</h4>
<p>alright I'll try to find the time :)</p>



<a name="204722776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204722776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204722776">(Jul 22 2020 at 21:03)</a>:</h4>
<p>but that reminds me that since triggering the issues requires codegen, the crater run is going to take a while</p>



<a name="204723390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204723390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204723390">(Jul 22 2020 at 21:09)</a>:</h4>
<blockquote>
<p>I suppose we’d be better off invoking polymorphisation to check that parameters which are present are unused, rather than assuming that any params present in parent substs are a result of polymorphisation.</p>
</blockquote>
<p>I think that might work, if we always use <code>polymorphize</code> and check if all used parameters are concrete it should be fine afaict</p>



<a name="204723465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204723465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204723465">(Jul 22 2020 at 21:10)</a>:</h4>
<p>I might have been too pessimistic here <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="204726216"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204726216" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204726216">(Jul 22 2020 at 21:42)</a>:</h4>
<p>goodbye polymorphisation, you lasted one day</p>



<a name="204726224"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204726224" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204726224">(Jul 22 2020 at 21:42)</a>:</h4>
<p>(that's the disable PR merged)</p>



<a name="204726431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204726431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204726431">(Jul 22 2020 at 21:45)</a>:</h4>
<p>it will come back !</p>



<a name="204909761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204909761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204909761">(Jul 24 2020 at 12:37)</a>:</h4>
<p>So, we'll need to discuss what we want to do in the reflection case (of <a href="https://github.com/rust-lang/rust/issues/74636">#74636</a>) but I've implemented what I think is going to be the starting point <a href="https://github.com/rust-lang/rust/commit/4d1d9885e92c75e260593b068cc059a5af340ffc">here</a>; cc <span class="user-mention" data-user-id="119009">@eddyb</span> <span class="user-mention" data-user-id="216206">@lcnr</span> - interested in what you think and I can work on implementing it.</p>



<a name="204921384"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204921384" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204921384">(Jul 24 2020 at 14:22)</a>:</h4>
<p>(opened <a href="https://github.com/rust-lang/rust/issues/74717">#74717</a> to discuss those changes)</p>



<a name="204925534"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204925534" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204925534">(Jul 24 2020 at 14:53)</a>:</h4>
<p><span aria-label="thumbs up" class="emoji emoji-1f44d" role="img" title="thumbs up">:thumbs_up:</span> looked over it and think this seems fine and fairly robust</p>



<a name="204925706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204925706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204925706">(Jul 24 2020 at 14:54)</a>:</h4>
<p>One thing which concerns me here is what happens if the reflection methods are called once with a polymorphized type and once with a non polymorphized one</p>



<a name="204925715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204925715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204925715">(Jul 24 2020 at 14:54)</a>:</h4>
<p>can this happen?</p>



<a name="204927632"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204927632" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204927632">(Jul 24 2020 at 15:09)</a>:</h4>
<p>or more accurately, should we guard from this by calling <code>polymorphize</code> in the <code>type_id</code> intrinsic?</p>



<a name="204931782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204931782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204931782">(Jul 24 2020 at 15:42)</a>:</h4>
<p>that makes sense but I don't have an opinion on whether or not we should</p>



<a name="204932007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204932007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204932007">(Jul 24 2020 at 15:44)</a>:</h4>
<p>We could probably add a debug assert which checks that we always use the polymorphized version here</p>



<a name="204932031"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204932031" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204932031">(Jul 24 2020 at 15:44)</a>:</h4>
<p>in case calling <code>polymorphize</code> causes perf issues here</p>



<a name="204932642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204932642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204932642">(Jul 24 2020 at 15:51)</a>:</h4>
<p>One thing I meant to mention was that this PR is almost certainly worse for perf</p>



<a name="204932823"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204932823" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204932823">(Jul 24 2020 at 15:52)</a>:</h4>
<p>we could a type flag here which might help</p>



<a name="204932962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204932962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204932962">(Jul 24 2020 at 15:54)</a>:</h4>
<p>but I also don't know how often <code>used_generic_parameters_needs_subst</code> will be called, so it might not actually matter (or it ends up extremely bad... idk)</p>



<a name="204933701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204933701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204933701">(Jul 24 2020 at 16:01)</a>:</h4>
<p>can't call polymorphisation from type flag infrastructure like we'd need to</p>



<a name="204933748"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204933748" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204933748">(Jul 24 2020 at 16:01)</a>:</h4>
<p>but flags do make sense - that's why we added <code>still_further_specializable</code> when working on polymorphisation</p>



<a name="204933761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204933761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204933761">(Jul 24 2020 at 16:01)</a>:</h4>
<p>because we don't have a tcx?</p>



<a name="204933869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204933869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204933869">(Jul 24 2020 at 16:02)</a>:</h4>
<p>yeah</p>



<a name="204933900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/204933900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#204933900">(Jul 24 2020 at 16:02)</a>:</h4>
<p>we had to change how closure substs were represented for that reason</p>



<a name="205000931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205000931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205000931">(Jul 25 2020 at 11:53)</a>:</h4>
<p>hmm, want to do a perf run to see how bad it is?</p>



<a name="205001589"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205001589" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205001589">(Jul 25 2020 at 12:12)</a>:</h4>
<p>Not sure if it would be representative with polymorphisation disabled.</p>



<a name="205001601"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205001601" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205001601">(Jul 25 2020 at 12:12)</a>:</h4>
<p>And if we enable it with a new commit then you won’t be able to tell which part is this PR and which is polymorphisation.</p>



<a name="205592381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205592381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205592381">(Jul 31 2020 at 13:55)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> can you take a look at <a href="https://github.com/rust-lang/rust/issues/74717">#74717</a>?</p>



<a name="205594913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205594913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205594913">(Jul 31 2020 at 14:14)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> none of the tests do any const eval, so I'm guessing that you're seeing these being hit by the const propagator, which should just not propagate in case it hits <code>TooGeneric</code>. So I don't understand what the problem actually is, can you give some more details on how the interpreter being overcautious is a problem?</p>



<a name="205595331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205595331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205595331">(Jul 31 2020 at 14:18)</a>:</h4>
<p>In that case, the fix in <a href="https://github.com/rust-lang/rust/issues/74717">#74717</a> is probably just wrong and I should just change what happens in the propagator in the <code>TooGeneric</code> case.</p>



<a name="205595548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205595548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205595548">(Jul 31 2020 at 14:20)</a>:</h4>
<p>Actually, the bug happens <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/monomorphize/collector.rs#L629-L633">here</a> - that isn't the propagator, right?</p>



<a name="205596285"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205596285" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205596285">(Jul 31 2020 at 14:26)</a>:</h4>
<p>no it's not the propagator, do you have some logs as to which constant is being evaluated here?</p>



<a name="205596373"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205596373" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205596373">(Jul 31 2020 at 14:27)</a>:</h4>
<p>oh <span aria-label="face palm" class="emoji emoji-1f926" role="img" title="face palm">:face_palm:</span> <code>&amp;(test::&lt;T&gt; as fn())</code> creates a promoted</p>



<a name="205596425"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205596425" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205596425">(Jul 31 2020 at 14:27)</a>:</h4>
<p>but what happens in the new <code>TypeId</code> test you added?</p>



<a name="205596436"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205596436" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205596436">(Jul 31 2020 at 14:27)</a>:</h4>
<p>I don't see any promotion there</p>



<a name="205596493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205596493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205596493">(Jul 31 2020 at 14:28)</a>:</h4>
<p>I’d need to double check, one sec.</p>



<a name="205598420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205598420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205598420">(Jul 31 2020 at 14:42)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> here's the backtrace from that test when I run it with <code>-Zpolymorphize=on</code> and without those changes: <a href="http://sprunge.us/T5pPOR">http://sprunge.us/T5pPOR</a></p>



<a name="205598991"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205598991" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205598991">(Jul 31 2020 at 14:47)</a>:</h4>
<p>hmm... that points to <a href="https://github.com/rust-lang/rust/blob/ac91673d895a0c578ed773e1280bdde8adb87b8c/src/librustc_codegen_llvm/intrinsic.rs#L294">https://github.com/rust-lang/rust/blob/ac91673d895a0c578ed773e1280bdde8adb87b8c/src/librustc_codegen_llvm/intrinsic.rs#L294</a></p>



<a name="205599033"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205599033" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205599033">(Jul 31 2020 at 14:47)</a>:</h4>
<p>if that returns <code>TooGeneric</code>, I would expect that to panic and that panic to be correct</p>



<a name="205599109"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205599109" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205599109">(Jul 31 2020 at 14:48)</a>:</h4>
<p>basically the compiler tried to compile <code>size_of::&lt;T&gt;()</code> where <code>T</code> is still generic</p>



<a name="205599178"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205599178" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205599178">(Jul 31 2020 at 14:48)</a>:</h4>
<p>But now a function can still be generic at this point due to polymorphisation.</p>



<a name="205599234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205599234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205599234">(Jul 31 2020 at 14:49)</a>:</h4>
<p>(<a href="https://github.com/rust-lang/rust/issues/74717">#74717</a> fixes that, but I don't claim that it is the correct solution)</p>



<a name="205599241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205599241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205599241">(Jul 31 2020 at 14:49)</a>:</h4>
<p>but that's wrong if <code>size_of::&lt;T&gt;()</code> is called, right?</p>



<a name="205599372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205599372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205599372">(Jul 31 2020 at 14:50)</a>:</h4>
<p>or is <code>test&lt;T&gt;</code> polymorphic because the result of <code>size_of::&lt;T&gt;()</code> is unused?</p>



<a name="205599396"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205599396" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205599396">(Jul 31 2020 at 14:50)</a>:</h4>
<p>yeah, but what works is <code>size_of_val(&amp;(|| ()))</code></p>



<a name="205599443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205599443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205599443">(Jul 31 2020 at 14:50)</a>:</h4>
<p>where <code>|| ()</code> is a polymorphized closure which therefore constains a <code>ty::Param</code></p>



<a name="205599458"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205599458" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205599458">(Jul 31 2020 at 14:50)</a>:</h4>
<p>I thought it was just <code>outer</code> which is polymorphic, not <code>foo</code> and <code>test</code></p>



<a name="205599476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205599476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205599476">(Jul 31 2020 at 14:50)</a>:</h4>
<p>oooooh</p>



<a name="205599580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205599580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205599580">(Jul 31 2020 at 14:51)</a>:</h4>
<p>Yeah - if you had this:</p>
<div class="codehilite"><pre><span></span><code><span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">_</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">size_of</span>::<span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">foo</span>::<span class="o">&lt;</span><span class="kt">u32</span><span class="o">&gt;</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>


<p>Then <code>T</code> is used, but if you have:</p>
<div class="codehilite"><pre><span></span><code><span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">A</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">_</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">size_of</span>::<span class="o">&lt;</span><span class="n">A</span><span class="o">&gt;</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">bar</span><span class="o">&lt;</span><span class="n">B</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">foo</span><span class="p">(</span><span class="o">||</span><span class="w"> </span><span class="p">());</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">bar</span>::<span class="o">&lt;</span><span class="kt">u32</span><span class="o">&gt;</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>


<p>Then <code>foo</code> considers <code>A</code> used, <code>bar</code> considers its <code>B</code> unused, and its closure inherits that, and that ends up getting to <code>size_of</code>.</p>



<a name="205599768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205599768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205599768">(Jul 31 2020 at 14:53)</a>:</h4>
<p>Polymorphisation cannot be transitive (checking what <code>foo</code> does with <code>T</code> to consider whether <code>bar</code> should consider <code>T</code> used in the example above) without hitting cycle errors - we hit similar issues like this when initially implementing polymorphisation, this is just a case that we didn't consider.</p>



<a name="205599794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205599794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205599794">(Jul 31 2020 at 14:53)</a>:</h4>
<p>so the <code>T</code> in <code>bar</code> is completely independent of <code>T</code> in <code>foo</code>?</p>



<a name="205599814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205599814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205599814">(Jul 31 2020 at 14:53)</a>:</h4>
<p>yeah, each function is considered independently.</p>



<a name="205599943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205599943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205599943">(Jul 31 2020 at 14:54)</a>:</h4>
<p>the <code>T</code> of bar ends up in <code>T</code> of <code>foo</code> as <code>foo::&lt;closure&lt;T_bar&gt;&gt;</code></p>



<a name="205599995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205599995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205599995">(Jul 31 2020 at 14:54)</a>:</h4>
<p>(the only case where polymorphisation of another body will influence polymorphisation of the current body is when fns or closures contain closures)</p>



<a name="205600016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205600016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205600016">(Jul 31 2020 at 14:54)</a>:</h4>
<p>ok, we need to use less confusing generics <span aria-label="grinning" class="emoji emoji-1f600" role="img" title="grinning">:grinning:</span></p>



<a name="205600044"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205600044" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205600044">(Jul 31 2020 at 14:55)</a>:</h4>
<div class="codehilite"><pre><span></span><code><span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">_</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">size_of</span>::<span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">bar</span><span class="o">&lt;</span><span class="n">U</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">foo</span><span class="p">(</span><span class="o">||</span><span class="w"> </span><span class="p">());</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">bar</span>::<span class="o">&lt;</span><span class="kt">u32</span><span class="o">&gt;</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="205600093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205600093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205600093">(Jul 31 2020 at 14:55)</a>:</h4>
<p>we have <code>foo::closure&lt;U&gt;</code></p>



<a name="205600144"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205600144" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205600144">(Jul 31 2020 at 14:55)</a>:</h4>
<p>exactly</p>



<a name="205600213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205600213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205600213">(Jul 31 2020 at 14:56)</a>:</h4>
<p>so we end up invoking <code>size_of::&lt;foo::closure&lt;U&gt;&gt;()</code></p>



<a name="205600223"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205600223" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205600223">(Jul 31 2020 at 14:56)</a>:</h4>
<p><code>foo::&lt;bar::{{closure#0}}&gt;</code></p>



<a name="205600274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205600274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205600274">(Jul 31 2020 at 14:56)</a>:</h4>
<p>yeah</p>



<a name="205600290"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205600290" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205600290">(Jul 31 2020 at 14:56)</a>:</h4>
<p>and through the power of compiler magic, <code>tcx.size_of</code> actually works on that even though <code>U</code> is unknown, becuase the layout computation never looks at <code>U</code></p>



<a name="205600309"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205600309" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205600309">(Jul 31 2020 at 14:56)</a>:</h4>
<p>yeah</p>



<a name="205600316"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205600316" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205600316">(Jul 31 2020 at 14:56)</a>:</h4>
<p>this was the missing part <span aria-label="grinning" class="emoji emoji-1f600" role="img" title="grinning">:grinning:</span></p>



<a name="205600322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205600322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205600322">(Jul 31 2020 at 14:56)</a>:</h4>
<p>thanks</p>



<a name="205600327"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205600327" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205600327">(Jul 31 2020 at 14:56)</a>:</h4>
<p><code>type_id</code> and <code>type_name</code> are interesting cases of this because it can make the result of polymorphisation observable</p>



<a name="205600335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205600335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205600335">(Jul 31 2020 at 14:57)</a>:</h4>
<p>the PR makes sense now</p>



<a name="205600358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205600358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205600358">(Jul 31 2020 at 14:57)</a>:</h4>
<p>which is why it needs bigger discussion</p>



<a name="205600380"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205600380" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205600380">(Jul 31 2020 at 14:57)</a>:</h4>
<p><code>type_name</code> is <span aria-label="shrug" class="emoji emoji-1f937" role="img" title="shrug">:shrug:</span></p>



<a name="205600394"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205600394" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205600394">(Jul 31 2020 at 14:57)</a>:</h4>
<p><code>type_id</code> is more interesting</p>



<a name="205600538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205600538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205600538">(Jul 31 2020 at 14:58)</a>:</h4>
<p>but I think also <span aria-label="shrug" class="emoji emoji-1f937" role="img" title="shrug">:shrug:</span> . For all I care <code>foo::&lt;bar::&lt;i32&gt;::{{closure#0}}&gt;``and </code>foo::&lt;bar::&lt;String&gt;::{{closure#0}}&gt;` are the same type</p>



<a name="205600546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205600546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205600546">(Jul 31 2020 at 14:58)</a>:</h4>
<p>but yes, let's punt that discussion</p>



<a name="205600914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205600914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205600914">(Jul 31 2020 at 15:01)</a>:</h4>
<p>In that case, the PR is probably fine then.</p>



<a name="205600942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205600942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205600942">(Jul 31 2020 at 15:01)</a>:</h4>
<p>Modulo any performance impact</p>



<a name="205601165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205601165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205601165">(Jul 31 2020 at 15:02)</a>:</h4>
<p>yes, the PR is fine, perf is likely irrelevant, as it only hits when we're polymorphiccing, which makese things faster anyway. Also these things are hit rarely I think. We should run perfbot though</p>



<a name="205601238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205601238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205601238">(Jul 31 2020 at 15:03)</a>:</h4>
<p>anyway, the PR looks fine to me. I worry about the fragility of these checks though</p>



<a name="205601499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205601499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205601499">(Jul 31 2020 at 15:05)</a>:</h4>
<p>Two things that come to mind: Rename the function to <code>ensure_monomorphic_enough</code> or something similar and make it return the <code>TooGeneric</code> error itself, so any calling code needs to <code>?</code> the error away. The second thing is that we should not be using <code>needs_subst</code> at all in the <code>mir::interpret</code> module (except for the implementation of <code>ensure_monomorphic_enough</code>. I'm fine with you just checking whether you covered all of them right now, but maybe we should add a rustc internal lint for it</p>



<a name="205605841"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205605841" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205605841">(Jul 31 2020 at 15:37)</a>:</h4>
<p>updated the PR with those changes <span class="user-mention" data-user-id="124288">@oli</span></p>



<a name="205606267"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205606267" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205606267">(Jul 31 2020 at 15:41)</a>:</h4>
<p>thanks! lgtm</p>



<a name="205607255"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205607255" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205607255">(Jul 31 2020 at 15:50)</a>:</h4>
<p>had a small nit, don't know if you want to do this as part of this PR or if I should try this in a followup</p>



<a name="205607585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205607585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205607585">(Jul 31 2020 at 15:53)</a>:</h4>
<p>replied to that</p>



<a name="205608241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205608241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205608241">(Jul 31 2020 at 15:59)</a>:</h4>
<p>replied to that</p>



<a name="205608260"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205608260" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205608260">(Jul 31 2020 at 15:59)</a>:</h4>
<p><span aria-label="laughter tears" class="emoji emoji-1f602" role="img" title="laughter tears">:laughter_tears:</span> not sure how useful these zulip messages are <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="205610663"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/tokio%20regression%20%28%2374614%29/near/205610663" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/tokio.20regression.20(.2374614).html#205610663">(Jul 31 2020 at 16:20)</a>:</h4>
<p>replied again, I think I'll leave it for a follow-up though</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>